import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *

testCase = "DBshop0019_添加品牌流程"
#1.打开后台 登录
firefox=openBrowser(urlAdmin)
DBshopLoginAdmin(firefox)
#点击商品管理,商品品牌"
DBshopEnterMenu2(firefox,"商品管理","商品品牌")
# 2.点击添加品牌按钮，品牌名称“苹果”。
firefox.find_element_by_xpath('//a[@class="btn btn-small btn-primary"]').click()
firefox.find_element_by_id('brand_name').send_keys('苹果')
# 3.点击“保存品牌”按钮。保存成功
firefox.find_element_by_xpath('(//button)[1]').click()


#断言
try:
    firefox.find_element_by_xpath('//td[contains(.,"苹果")]/following-sibling::td[4]/a[1]')
    writeLog("%s 测试通过" % testCase)
except:
    writeLog("%s 测试不通过" % testCase)
    getPhoto(firefox)
firefox.quit()